package com.victualler.core.base.dao;

import com.victualler.core.common.annotation.InitEditColumn;
import com.victualler.core.common.annotation.ListShowColumn;
import com.victualler.core.common.enums.ColumnFormatEnum;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author: Guoshichang
 * @Date: Create in 18:02 2018/4/5
 * @Discription:  通用基类
 */
@MappedSuperclass
public abstract class BaseDao implements Serializable{
    @Id
    @GeneratedValue
    @ListShowColumn(title = "ID",sort = -1)
    @InitEditColumn(title = "ID",canEdit = false,sort = -1,required = false)
    private Long id ; //表id
    //实体状态
    @Column(length = 1)
    @ListShowColumn(title = "状态",sort = 998,type = ColumnFormatEnum.DICT,dictCodeType = "EntityState")
    @InitEditColumn(title = "状态",sort = 998,type = ColumnFormatEnum.DICT,dictCodeType = "EntityState",required = false)
    private int state = 0;
    //创建时间
    @ListShowColumn(title = "创建时间",sort = 999,type = ColumnFormatEnum.DATE)
    @InitEditColumn(title = "创建时间",canEdit = false,sort = 999,type = ColumnFormatEnum.DATE,required = false)
    private Date createDate = new Date();


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
}
